<?php
class SettingsForm extends Zend_Form {
    public function __construct($options = null) 
    {
    	$baseurl 		= new MHDEV_View_Helper_BaseUrl();
    	$translation	= Zend_Registry::get('lang');
    	
        parent::__construct($options);
        
        $this->setName('settings');
		$this->setAction($baseurl->BaseUrl() . '/backend/settings/request');
		
		// Boardname
        $board = new Zend_Form_Element_Text('board_name');
        $board->setLabel($translation->_('admin_settings_board'));
        $board->setDescription($translation->_('admin_settings_dboard'));
        $board->setRequired(true);
        $board->addValidator('NotEmpty');
        $board->setErrorMessages(array(
            0 => $translation->_('admin_settings_error_board')
        ));
        
        // Admin-Mail
        $mail = new Zend_Form_Element_Text('admin_mail');
        $mail->setLabel($translation->_('admin_settings_mail'));
        $mail->setDescription($translation->_('admin_settings_dmail'));
        $mail->setRequired(true);
        $mail->addValidator('NotEmpty');
        $mail->setErrorMessages(array(
            0 => $translation->_('admin_settings_error_mail')
        ));
        
        // Domain-Name
        $domain = new Zend_Form_Element_Text('domain_name');
        $domain->setLabel($translation->_('admin_settings_domain'));
        $domain->setDescription($translation->_('admin_settings_ddomain'));
        
        // Threads per page
        $threadspp = new Zend_Form_Element_Select('threads_per_page');
        $threadspp->setLabel($translation->_('admin_settings_threadspp'));
        $threadspp->setDescription($translation->_('admin_settings_dthreadspp'));
        $threadspp->addMultiOption('10', '10');
        $threadspp->addMultiOption('20', '20');
        $threadspp->addMultiOption('50', '50');
        $threadspp->addMultiOption('100', '100');
        $threadspp->setDescription($translation->_('register_dthreadspp'));
        
        // Posts per page
        $postspp = new Zend_Form_Element_Select('posts_per_page');
        $postspp->setLabel($translation->_('admin_settings_postspp'));
        $postspp->addMultiOption('10', '10');
        $postspp->addMultiOption('20', '20');
        $postspp->addMultiOption('50', '50');
        $postspp->addMultiOption('100', '100');
        $postspp->setDescription($translation->_('admin_settings_dpostspp'));
        
        
        // language
        $language = new Zend_Form_Element_Select('default_language');
        $language->setLabel($translation->_('admin_settings_language'));
        $language->setDescription($translation->_('admin_settings_dlanguage'));
        $language->addMultiOption('en', 'English');
        $language->addMultiOption('de', 'German');
		
        // is online
		$is_online = new Zend_Form_Element_Checkbox('is_online');
		$is_online->setLabel($translation->_('admin_settings_online'));
		$is_online->setDescription($translation->_('admin_settings_donline'));
		
		// user auth
		$user_auth = new Zend_Form_Element_Checkbox('user_auth');
		$user_auth->setLabel($translation->_('admin_settings_auth'));
		$user_auth->setDescription($translation->_('admin_settings_dauth'));
		
		// allow_rating
		$rating = new Zend_Form_Element_Checkbox('allow_rating');
		$rating->setLabel($translation->_('admin_settings_rating'));
		$rating->setDescription($translation->_('admin_settings_drating'));
		
		// avatar_allowed
		$avatar_allowed = new Zend_Form_Element_Checkbox('avatar_upload');
		$avatar_allowed->setLabel($translation->_('admin_settings_avatar'));
		$avatar_allowed->setDescription($translation->_('admin_settings_davatar'));
		
		// avatar_size
		$avatar_size = new Zend_Form_Element_Text('avatar_size');
		$avatar_size->setLabel($translation->_('admin_settings_avasize'));
		$avatar_size->setDescription($translation->_('admin_settings_davasize'));
		
		// avatar_height
		$avatar_height = new Zend_Form_Element_Text('avatar_height');
		$avatar_height->setLabel($translation->_('admin_settings_avaheight'));
		$avatar_height->setDescription($translation->_('admin_settings_davaheight'));
		
		// avatar_width
		$avatar_width = new Zend_Form_Element_Text('avatar_width');
		$avatar_width->setLabel($translation->_('admin_settings_avawidth'));
		$avatar_width->setDescription($translation->_('admin_settings_davawidth'));
		
		// allow_votes
		$votes = new Zend_Form_Element_Checkbox('allow_votes');
		$votes->setLabel($translation->_('admin_settings_votes'));
		$votes->setDescription($translation->_('admin_settings_dvotes'));
		
		// Offline message
        $offline = new Zend_Form_Element_Textarea('offline_message');
        $offline->setLabel($translation->_('admin_settings_offline'));
        $offline->setDescription($translation->_('admin_settings_doffline'));
        $offline->addFilter('StringTrim');
		$offline->setAttrib('rows','5');
		$offline->setAttrib('cols','30');
		
        // Submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel($translation->_('form_save'));
        
        $this->addElements(array($board, $mail, $domain, $language, $user_auth, $rating, $votes, $avatar_allowed, $avatar_size, $avatar_height, $avatar_width, $is_online, $offline, $threadspp, $postspp, $submit));
    }
}  
?>